import { request } from '@/utils/request.js'

/**
 * 客户列表 API JS
 */

export default {

  /**
   * 获取客户列表分页列表
   * @returns
   */
  getList (params = {}) {
    return request({
      url: 'customers/customer/index',
      method: 'get',
      params
    })
  },

  /**
   * 添加客户列表
   * @returns
   */
  save (data = {}) {

    return request({
      url: 'customers/customer/save',
      method: 'post',
      data
    })
  },

  /**
   * 更新客户列表数据
   * @returns
   */
  update (id, data = {}) {
    return request({
      url: 'customers/customer/update/' + id,
      method: 'put',
      data
    })
  },
  updateBatch (data = {}) {
    return request({
      url: 'customers/customer/updateBatch',
      method: 'put',
      data
    })
  },

  /**
   * 读取客户列表
   * @returns
   */
  read (id,data={}) {
    return request({
      url: 'customers/customer/read/' + id,
      method: 'get',
      data
    })
  },

  /**
   * 将客户列表删除，有软删除则移动到回收站
   * @returns
   */
  deletes (data) {
    return request({
      url: 'customers/customer/delete',
      method: 'delete',
      data
    })
  },

  /**
   * 从回收站获取客户列表数据列表
   * @returns
   */
  getRecycleList (params = {}) {
    return request({
      url: 'customers/customer/recycle',
      method: 'get',
      params
    })
  },

  /**
   * 恢复客户列表数据
   * @returns
   */
  recoverys (data) {
    return request({
      url: 'customers/customer/recovery',
      method: 'put',
      data
    })
  },

  /**
   * 真实删除客户列表
   * @returns
   */
  realDeletes (data) {
    return request({
      url: 'customers/customer/realDelete',
      method: 'delete',
      data
    })
  },

  /**
   * 更改客户列表数据
   * @returns
   */
  changeStatus (data = {}) {
    return request({
      url: 'customers/customer/changeStatus',
      method: 'put',
      data
    })
  },

  /**
   * 客户列表导出
   * @returns
   */
  exportExcel (params = {}) {
    return request({
      url: 'customers/customer/export',
      method: 'post',
      responseType: 'blob',
      params
    })
  },

  login (userId) {
    return request({
      url: 'customers/customer/login',
      method:'post',
      params:{user_id:userId}
    })
  }
  ,
  repassword (id) {
    return request({
      url: 'customers/customer/repassword',
      method:'post',
      params:{id:id}
    })
  }

}